//根据作家的id获得相应的信息

import axios from "axios";
import { ElMessage } from "element-plus";
import { h, ref } from "vue";
import { getCurrentInstance } from "vue";

//对某本书发表评论
export async function getWriteInfo(user_name,proxy) {
  console.log(user_name);
  try {
    const response = await proxy.$http.post("/get_writer/", {
      user_name : user_name,
    });
    console.log(response);
    const res = response.data;
    console.log(res);
    if (res.status === "error") {
      ElMessage.error("获取作家信息失败");
    } else {
      // ElMessage.success("获取作家信息成功");
      return res;
    }
  } catch (error) {
    console.error(`Error fetching ${user_name} author:`, error);
    return [];
  }
}
